//
//  LocalHelper.h
//  LocalTest
//
//  Created by Pibinuo on 15/12/3.
//  Copyright © 2015年 皮比诺. All rights reserved.
//

#import "NewsOneTableViewCell.h"

@implementation NewsOneTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self p_setupViews];
        self.backgroundColor = [UIColor groupTableViewBackgroundColor];
    }
    return self;
}

- (void)p_setupViews
{
    self.image = [[UIImageView alloc] init];
    self.image.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.image];
    
    self.titleLable = [[UILabel alloc] init];
    self.titleLable.font = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];
    self.titleLable.numberOfLines = 0;
    [self.contentView addSubview:self.titleLable];
    
    self.timeLable = [[UILabel alloc] init];
    self.timeLable.font = [UIFont systemFontOfSize:8];
    self.timeLable.tintColor = [UIColor grayColor];
    [self.contentView addSubview:self.timeLable];
    
    self.commentLable = [[UILabel alloc] init];
    self.commentLable.font = [UIFont systemFontOfSize:8];
    self.commentLable.tintColor = [UIColor grayColor];
    self.commentLable.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.commentLable];
    
    self.commentImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"message"]];
    [self.contentView addSubview:self.commentImage];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.image.frame = CGRectMake(10, 8, CGRectGetHeight(self.contentView.frame) * 1.2, CGRectGetHeight(self.contentView.frame) - 16);
    self.titleLable.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 8, CGRectGetMinY(self.image.frame), CGRectGetWidth(self.contentView.frame) - CGRectGetWidth(self.image.frame) - 24, 60);
    self.timeLable.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 8, CGRectGetMaxY(self.image.frame) - 10, 50, 10);
    self.commentImage.frame = CGRectMake(CGRectGetWidth(self.contentView.frame) - 25, CGRectGetMinY(self.timeLable.frame), 12, 10);
    self.commentLable.frame = CGRectMake(CGRectGetMinX(self.commentImage.frame) - 40, CGRectGetMinY(self.commentImage.frame), 35, 10);
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
